import crypto from 'crypto';
export function testEncr(body, ts, nonceStr) {
	try{
		const requestTime = ts.toString();
		const key = `${nonceStr}-${requestTime}`;
		
		const keyBytes = Buffer.from(key, 'utf8');
		const bodyBytes = Buffer.from(body, 'utf8');
		
		const hmac = crypto.createHmac('sha256', keyBytes);
		hmac.update(bodyBytes);
		
		const signatureBytes = hmac.digest('hex');
		const signature = `Bearer ${signatureBytes}`;
		return signature;
	}catch(err) {
		console.log('err', err);
	}
}